import http from "../../http"
import type { MenuReq } from "./MenuModel"

export class MenuApi {
    static listParentTree() {
        return http.get('/menu/list-parent-menu-tree')
    }

    static newAdd(saveReq: MenuReq) {
        return http.post('/menu', saveReq)
    }

    static delete(menuId: number | string) {
        return http.delete(`/menu/${menuId}`)
    }

    static edit(saveReq: MenuReq) {
        return http.put('/menu', saveReq)
    }

    static listMenuTree() {
        return http.get('/menu/list-menu-tree')
    }

    static listTreeMenuByUserIdAndRoleId(userId: string | number, roleId: string | number) {
        return http.get(`/menu/list-tree-menu/${userId}/${roleId}`)
    }

    static listVueRouterTree(userId: string | number) {
        return http.get(`/menu/list-vue-router-tree`, { userId })
    }
}